import request from '@/utils/request'

/**
 * 获取角色列表
 * @param {*} params
 * @returns Promise<Object>
 */
export const roleGetRoleListApi = (params) => request.get('/sys/role', { params })

/**
 * 新增角色
 * @param {*} data
 * @returns Promise<Object>
 */
export const roleAddRoleApi = (data) => request.post('/sys/role', data)

/**
 * 修改角色
 * @param {*} data
 * @returns Promise<null>
 */
export const roleUpdateRoleApi = (data) => request.put(`/sys/role/${data.id}`, data)

/**
 * 删除角色
 * @param {*} id
 * @returns Promise<null>
 */
export const roleDeleteRoleApi = (id) => request.delete(`/sys/role/${id}`)

/**
 * 获取角色详情
 * @param {*} id
 * @returns Promise<Object>
 */
export const roleGetRoleDetailApi = (id) => request.get(`/sys/role/${id}`)

/**
 * 给角色分配权限
 * @param {*} data
 * @returns Promise<null>
 */
export const roleAssignPermApi = (data) => request.put('/sys/role/assignPrem', data)
